def getRes(a, b, x, y):
    max_sum = max(a, b)
    min_sum = min(a, b)
    max_xy = max(x, y)
    min_xy = min(x, y)
    count = 0

    while min_sum >= 0:
        max_sum -= max_xy
        min_sum -= min_xy
        if max_sum < min_sum:
            max_sum, min_sum = min_sum, max_sum
        count += 1
    count = max(0, count - 1)
    return count


if __name__ == "__main__":
    x = input()
    a, b, x, y = list(map(int, x.split(" ")))
    res = getRes(a, b, x, y)
    print(res)
